-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parser errors from within includes should not be rescueable #73722
Conversation
@@ -470,6 +479,8 @@ def _queue_put(item, *args, **kwargs): | |||
|
|||
mock_inc_file._filename = "test.yml" | |||
res = strategy_base._load_included_file(included_file=mock_inc_file, iterator=mock_iterator) | |||
self.assertEqual(len(res), 1) | |||
self.assertTrue(isinstance(res[0], Block)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code change actually revealed an issue with this unit test.
The mocks caused the parent task to have collections
set as a MagicMock
instance resulting in debug
not being found and _load_included_file
throwing AnsibleParserError
which was then shadowed by AnsibleError
and _load_included_file
returned an empty list. The res
was not asserted in any way and the test passed.
With this PR AnsibleParserError
is thrown instead of being shadowed by AnsibleError
, the unit test failed with AnsibleParserError
. Now the mocks are "fixed" and the result checked for expected result.
SUMMARY
Fixes #73657
ISSUE TYPE
COMPONENT NAME
lib/ansible/plugins/strategy/__init__.py
lib/ansible/plugins/strategy/free.py
lib/ansible/plugins/strategy/linear.py